package com.bristua.barcode.supplier.biz;

import com.bristua.barcode.common.util.DateUtils;
import com.bristua.barcode.common.util.SequenceUtil;
import com.bristua.barcode.supplier.dao.TQrCodeMapper;
import com.bristua.barcode.supplier.model.TQrCode;
import com.bristua.barcode.supplier.model.condition.AddSupplierQrcodeParams;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;

import javax.annotation.Resource;

/**
 * Created by Administrator on 2019/8/30.
 */
@Service
@Transactional
public class UpdateSupplierQrcodeBiz {

    @Resource
    private TQrCodeMapper tQrCodeMapper;

    public void updateSupplierQrcode(AddSupplierQrcodeParams addSupplierQrcodeParams){
        TQrCode tQrCode = new TQrCode();
        tQrCode.setQrCodeId(addSupplierQrcodeParams.getQrCodeId());
        if(!StringUtils.isEmpty(addSupplierQrcodeParams.getQrCodeUrl())){
            tQrCode.setQrCodeUrl(addSupplierQrcodeParams.getQrCodeUrl());
        }
        if(addSupplierQrcodeParams.getChannelId()!=null){
            tQrCode.setChannelId(addSupplierQrcodeParams.getChannelId());
        }
        if(!StringUtils.isEmpty(addSupplierQrcodeParams.getSupplierId())){
            tQrCode.setSupplierId(addSupplierQrcodeParams.getSupplierId());
        }
        if(!StringUtils.isEmpty(addSupplierQrcodeParams.getUserName())){
            tQrCode.setUserName(addSupplierQrcodeParams.getUserName());
        }
        if(!StringUtils.isEmpty(addSupplierQrcodeParams.getPassword())){
            tQrCode.setPassword(addSupplierQrcodeParams.getPassword());
        }
        tQrCodeMapper.updateByPrimaryKeySelective(tQrCode);
    }
}
